package com.example.backend.domain.enums;

/**
 * 工单状态跟踪类型枚举
 */
public enum TicketStatusTrackingType {
    /**
     * 工单创建
     */
    CREATED("CREATED", "工单创建"),
    
    /**
     * 状态变更
     */
    STATUS_CHANGED("STATUS_CHANGED", "状态变更"),
    
    /**
     * 优先级变更
     */
    PRIORITY_CHANGED("PRIORITY_CHANGED", "优先级变更"),
    
    /**
     * 工单分配
     */
    ASSIGNED("ASSIGNED", "工单分配"),
    
    /**
     * 工单重新分配
     */
    REASSIGNED("REASSIGNED", "工单重新分配"),
    
    /**
     * 工单升级
     */
    ESCALATED("ESCALATED", "工单升级"),
    
    /**
     * 工单解决
     */
    RESOLVED("RESOLVED", "工单解决"),
    
    /**
     * 工单关闭
     */
    CLOSED("CLOSED", "工单关闭"),
    
    /**
     * 工单重新打开
     */
    REOPENED("REOPENED", "工单重新打开"),
    
    /**
     * 工单取消
     */
    CANCELLED("CANCELLED", "工单取消"),
    
    /**
     * 添加评论
     */
    COMMENT_ADDED("COMMENT_ADDED", "添加评论"),
    
    /**
     * 添加附件
     */
    ATTACHMENT_ADDED("ATTACHMENT_ADDED", "添加附件"),
    
    /**
     * 截止时间变更
     */
    DUE_DATE_CHANGED("DUE_DATE_CHANGED", "截止时间变更"),
    
    /**
     * 标签变更
     */
    TAG_CHANGED("TAG_CHANGED", "标签变更"),
    
    /**
     * 分类变更
     */
    CATEGORY_CHANGED("CATEGORY_CHANGED", "分类变更"),
    
    /**
     * 其他变更
     */
    OTHER("OTHER", "其他变更");

    private final String code;
    private final String description;

    TicketStatusTrackingType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据代码获取枚举
     */
    public static TicketStatusTrackingType fromCode(String code) {
        for (TicketStatusTrackingType type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown tracking type code: " + code);
    }
}

